using UnityEngine;
using QFramework;
using ProjectSurvivor;

namespace QFrameworkSurvivor
{
	public partial class FxController : ViewController
	{
		private static FxController mDefault;
        private void Awake()
        {
            mDefault = this;
        }
        private void OnDestroy()
        {
            mDefault = null;
        }
        
        public static void Play(SpriteRenderer sprite, Color dissolveColor,Texture texture)
        {
            mDefault.EnemyDieFx.Instantiate()
                .Position(sprite.Position())
                .LocalScale(sprite.LocalScale())
                .Self(self => 
                {
                    self.GetComponent<Dissolve>().DissolveColor = dissolveColor;
                    self.GetComponent<Dissolve>().Texture = texture;
                    self.sprite = sprite.sprite;
                })
                .Show();
        }
    }
}
